package javahtml5;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.widget.Toast;

import com.xiyoumobile.dengtuo.flowershop.EternalActivity;
import com.xiyoumobile.dengtuo.flowershop.FlowerDetailActivity;
import com.xiyoumobile.dengtuo.flowershop.KindsActivity;
import com.xiyoumobile.dengtuo.flowershop.MainActivity;
import com.xiyoumobile.dengtuo.flowershop.R;

import fragment.HomeFragment;

/**
 * Created by Admin on 2016/3/11.
 */
public class JsMainActivity {

    //当前页面的上下文
    private Context mContext;
    private  WebView mWebView;
    public JsMainActivity(Context context,WebView webView){
        mContext = context;
        mWebView = webView;
    }

    //跳转到分类里面
    @JavascriptInterface
    public void goKinds(int id,String name){
        Intent intent = new Intent(mContext, KindsActivity.class);
        intent.putExtra("id",id);
        intent.putExtra("name",name);
        mContext.startActivity(intent);
    }


    //跳转到详情
    @JavascriptInterface
    public void goDetails(String  id){

        Intent intent = new Intent(mContext, FlowerDetailActivity.class);
        intent.putExtra("id",id);
        mContext.startActivity(intent);
    }

    @JavascriptInterface
    public void toast(String info){
        Toast.makeText(mContext,info,Toast.LENGTH_SHORT).show();
    }
}
